#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <vector>

using namespace std;

struct ListNode {
    int val;
    ListNode* next;
    ListNode(int x) : val(x), next(NULL) {}
};

struct TreeNode {
    int val;
    TreeNode* left;
    TreeNode* right;
    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};

class Solution {
   private:
    int occu[100][100];
    bool occu_bool[100][100];
    int count;
    int _m;
    int _n;
    int bfs(int posX, int posY) {
        if (posX < 0 || posY < 0 || posX >= _m || posY >= _n) {
            return 0;
        }
        int now = occu[posX][posY];
        if (now == 0 || occu_bool[posX][posY])
            return 0;
        occu_bool[posX][posY] = true;
        return 1 + bfs(posX - 1, posY) + bfs(posX, posY - 1) +
               bfs(posX + 1, posY) + bfs(posX, posY + 1);
    }

   public:
    int movingCount(int m, int n, int k) {
        _m = m;
        _n = n;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                occu[i][j] = (i / 10 + i % 10 + j / 10 + j % 10 <= k) ? 1 : 0;
                occu_bool[i][j] = false;
            }
        }
        int count = bfs(0, 0);
        return count;
    }
};

int main() {
    cout << "Hello, World!";
    Solution().movingCount(3, 1, 0);
    return 0;
}